import java.util.ArrayList;
import java.util.List;
public class XshellInvoker {

    private List<ICommand> commandList = new ArrayList<> ();
    
    public XshellInvoker(List<ICommand> commandList) {
        this.commandList = commandList;
    }

    public void execute(ICommand command) {
        command.execute();
    }

    public void executeCdAndLs() {
        for (ICommand command :commandList) {
            if (command instanceof LsCommand || command instanceof CdCommand) {
                command.execute();
            }
        }
    }

    public void executeAll() {
        for (ICommand command : commandList) {
            command.execute();
        }
    }
}